package com.cliente;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import com.example.conver.R;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import domain.AdministradorVO;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

public class Encriptar extends Activity {

	TextView texto;
	Button add,undo;
	Controller C = new Controller();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.encriptar);

		texto = (TextView) findViewById(R.id.texto);
		add = (Button) findViewById(R.id.encr);
		undo = (Button) findViewById(R.id.des);

		add.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
						
						Log.i("encriptar", "aasd");
						SharedPreferences prefs = getSharedPreferences("session", Context.MODE_PRIVATE);
						String result = C.agregar(texto.getText().toString(),prefs.getString("TOKEN", "vacio"),"encr" );
						texto.setText(result.toString());
			}
		});
		
		undo.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
						
						Log.i("desencriptar", "aasd");
						SharedPreferences prefs = getSharedPreferences("session", Context.MODE_PRIVATE);
						String result = C.agregar(texto.getText().toString(),prefs.getString("TOKEN", "vacio"),"des" );
						texto.setText(result.toString());

			}
		});

	}

	

}
